﻿using Grow.Db.CreateDb;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace Grow.EventBus.Cap.SubscriberEventData
{
    public class SubscriberEventDataDbMap : DbMapBase
    {
        public override void AddDb(IDbBuilder dbBuilder)
        {
            var entityBuilder = dbBuilder.GetEntityBuilder<SubscriberEventDataEntity>();
            entityBuilder.HasComment("订阅消息表");


            entityBuilder.GetEntityPropertyBuilder(a => a.EnvironmentName)
               .HasComment("主机")
                .HasMaxLength(100);

            entityBuilder.GetEntityPropertyBuilder(a => a.EventName)
                .HasComment("事件名称")
                 .HasMaxLength(100);

            entityBuilder.GetEntityPropertyBuilder(a => a.EventHandlerName)
               .HasComment("事件处理名称")
               .HasMaxLength(100);

            entityBuilder.GetEntityPropertyBuilder(a => a.EventDataType)
               .HasComment("事件处理名称")
               .HasMaxLength(100);

            entityBuilder.GetEntityPropertyBuilder(a => a.EventHandlerType)
               .HasComment("事件处理名称")
               .HasMaxLength(100);

            entityBuilder.GetEntityPropertyBuilder(a => a.EventBody)
                .HasComment("事件内容")
                .HasMaxLength(100);

            entityBuilder.GetEntityPropertyBuilder(a => a.EventHeads)
                .HasComment("事件附加数据")
                .HasMaxLength(500);

            entityBuilder.GetEntityPropertyBuilder(a => a.EventDataStatus)
                .HasComment("状态");

            entityBuilder.GetEntityPropertyBuilder(a => a.RetryCount)
                .HasComment("已重试次数");

            entityBuilder.GetEntityPropertyBuilder(a => a.SendAt)
                .HasComment("锁定结束时间");

            entityBuilder.GetEntityPropertyBuilder(a => a.DelayAt)
                .HasComment("延迟消费时间");

            entityBuilder.GetEntityPropertyBuilder(a => a.LockEndTime)
                .HasComment("锁定结束时间");

            entityBuilder.GetEntityPropertyBuilder(a => a.ExpireTime)
                .HasComment("过期时间");
        }
    }
}
